<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<div id="find_question_dialog" style="display: none;">
  <a href="<%= context_url(@context, :context_question_banks_url, :include_bookmarked => '1', :inherited => '1') %>" class="find_question_banks_url" style="display: none;">&nbsp;</a>
  <a href="/<%= @quiz.context_url_prefix %>/question_banks/{{ question_bank_id }}/questions?inherited=1" class="question_bank_questions_url" style="display: none;">&nbsp;</a>
  <a href="<%= context_url(@context, :context_quiz_quiz_questions_url, @quiz.id) %>" class="add_questions_url" style="display: none;">&nbsp;</a>
  <div style="float: right; padding-right: 5px; line-height: 2.5em;">
    <a href="<%= context_url(@context, :context_question_banks_url) %>">{{#t}}View Course Question Banks{{/t}}</a>
  </div>
  <div class="clear"></div>
  <div class="message" style="display: none;"></div>
  <% css_bundle("side_tabs_table") %>
  <table class="side_tabs_table" style="width: 100%;">
    <tr>
      <td class="left">
        <ul class="side_tabs bank_list">
          <li class="bank blank" style="display: none;">
            <a href="#">
              <span class="title">{{#t}}Bank Name{{/t}}</span>
              <span class="id" style="display: none;">&nbsp;</span>
            </a>
            <div class="sub_content">
              <%= t(:bank_description, "%{bank_name}, %{n} questions",
                    :bank_name => raw('<span class="cached_context_short_name">&nbsp;</span>'),
                    :n => raw('<span class="assessment_question_count">&nbsp;</span>')) %>
            </div>
          </li>
        </ul>
      </td>
      <td class="right">
        <div class="side_tabs_content">
          <div class="question_message"></div>
          <div class="question_list_holder" style="display: none;">
            <a href="#" class="select_all_link">{{#t}}Select All{{/t}}</a> |
            <a href="#" class="clear_all_link">{{#t}}Clear All{{/t}}</a>
            <ul class="question_list unstyled_list">
              <li class="found_question blank" style="display: none;">
                <input type="checkbox"/>
                <label class="question_name"></label>
                <div class="already_added_message">{{#t}}this question is already on the quiz{{/t}}</div>
                <div class="question_text"></div>
              </li>
            </ul>
            <a href="#" class="page_link">{{#t}}more questions{{/t}}</a>
            <div class="button-container quiz_group_select_holder">
              <label for="quiz_group_select"><%= before_label(:add_questions_to_group, "Add questions to the question group") %></label>
              <select class="quiz_group_select" id="quiz_group_select">
                <option value="none">{{#t}}[ No Group ]{{/t}}</option>
                <option class="bottom" value="new">{{#t}}[ New Group ]{{/t}}</option>
              </select>
            </div>
            <div class="button-container" style="margin-bottom: 5px;">
              <button type="button" class="btn submit_button">{{#t}}Add Questions{{/t}}</button>
              <button type="button" class="btn btn button-secondary cancel_button">{{#t}}Cancel{{/t}}</button>
            </div>
          </div>
        </div>
      </td>
    </tr>
  </table>
</div>
<div id="find_bank_dialog" style="display: none;">
  <a href="<%= context_url(@context, :context_question_banks_url, :include_bookmarked => '1', :inherited => '1') %>" class="find_question_banks_url" style="display: none;">&nbsp;</a>
  <div style="float: right; padding-right: 5px; line-height: 2.5em;">
    <a href="<%= context_url(@context, :context_question_banks_url) %>">{{#t}}View Course Question Banks{{/t}}</a>
  </div>
  <div class="clear"></div>
  <div class="message" style="display: none;"></div>
  <div class="find_banks">
    {{#t}}Select a question bank from the list below to link it to the this quiz as a question group.{{/t}}
    <ul class="side_tabs bank_list unstyled_list">
      <li class="bank blank" style="display: none;">
        <div class="title">{{#t}}Bank Name{{/t}}</div>
        <span class="id" style="display: none;">&nbsp;</span>
        <div class="sub_content">
          <%= t(:bank_description, "%{bank_name}, %{n} questions",
                :bank_name => raw('<span class="cached_context_short_name">&nbsp;</span>'),
                :n => raw('<span class="assessment_question_count">&nbsp;</span>')) %>
        </div>
      </li>
    </ul>
    <div class="button-container" style="margin-bottom: 5px;">
      <button type="button" class="btn submit_button">{{#t}}Select Bank{{/t}}</button>
      <button type="button" class="btn btn button-secondary cancel_button">{{#t}}Cancel{{/t}}</button>
    </div>
  </div>
</div>
<div id="add_question_group_dialog" style="display: none;" title="{{#t}}Add a New Question Group{{/t}}">
  <h2>{{#t}}Add a New Question Group{{/t}}</h2>
  <a href="<%= context_url(@context, :context_quiz_quiz_groups_url, @quiz.id) %>" class="add_question_group_url" style="display: none;">&nbsp;</a>
  <table class="formtable">
    <tr>
      <td><label for="found_question_group_name"><%= before_label(:group_name, "Group Name") %></label></td>
      <td><input id="found_question_group_name" type="text" name="quiz_group[name]" /></td>
    </tr><tr>
      <td><label for="found_question_group_pick"><%= before_label(:group_pick_count, "Pick") %></label></td>
      <td>
        <%= t(:group_pick_count, "%{pick_count} questions", :pick_count => raw('<input id="found_question_group_pick" type="text" style="width: 50px;" name="quiz_group[pick_count]" />')) %><br/>
        <span style="font-size: 0.8em;">(<%= t('hints.group_pick_count', "%{pick_count} selected so far", :pick_count => raw('<span class="questions_count">&nbsp;</span>')) %>)</span>
      </td>
    </tr><tr>
      <td><label for="found_question_group_points"><%= before_label(:group_points, "Points") %></label></td>
      <td><%= t(:group_points, "%{points} per question", :points => raw('<input id="found_question_group_points" type="text" style="width: 50px;" class="float_value" name="quiz_group[question_points]" />')) %></td>
    </tr><tr>
      <td colspan="2">
        <div class="button-container">
          <button type="button" class="btn submit_button">{{#t}}Create Group{{/t}}</button>
          <button type="button" class="btn btn button-secondary cancel_button">{{#t}}Cancel{{/t}}</button>
        </div>
      </td>
    </tr>
  </table>
</div>
